<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use App\Http\Controllers\TargetController;

class TargetServer extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'targetsocket:init';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Target Websocket Service';

    /**
     * Execute the console command.
     */
    public function handle()
    {
        //
    	$server = IoServer::factory(
            new HttpServer(
                new WsServer(
                    new TargetController()
                )
            ),
            9502
           );
           $server->run();       
    }
}
